<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>邀请朋友进店</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <link th:href="@{/shoppingApi/css/public.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/publicOfuser.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/combtn.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/accsetting.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/weui.min.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/jquery-weui.min.css}" rel="stylesheet">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header"  th:content="${_csrf.headerName}"/>
</head>
<div class="main visit">

    <div class="main_con">
        <div class="visit-img">
            <img id="ewm">
        </div>
    </div>
    <div class="visit-btns">
        <a href="/wap/openUserCenter" class="btn message">返回个人中心</a>
        <button class="btn timeline" id="save" onclick="saveEwm();">保存二维码</button>
    </div>

</div>
</body>
<script th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/shoppingApi/js/jquery-weui.min.js}"></script>
<script>

    var ewm="";

    $(document).ready(function(){
        $.showLoading();

        //加载二维码
        $.ajax({
            url: "/WeChatQrcode",
            success:function (res) {
                if(res.msgCode=="000000"){
                    ewm = res.data;
                    $("#ewm").attr("src",res.data);
                }else {
                    $.alert(res.errorDetail)
                }

                $.hideLoading();

            }
        })
    });

    function saveEwm() {
        //alert(ewm);
        var alink = document.createElement("a");
        alink.href = ewm;
        alink.click();
    }

</script>
</html>